package com.ynet.middleground.mobile.approve.conf;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.ifp.framework.TaskLeader;

@Configuration
public class CatFilterConfig {

    // @Bean
    // public FilterRegistrationBean catFilter() {
    //
    // FilterRegistrationBean registration = new FilterRegistrationBean();
    // CatFilter filter = new CatFilter();
    // registration.setFilter(filter);
    // registration.addUrlPatterns("/*");
    // registration.setName("cat-filter");
    // registration.setOrder(1);
    //
    // return registration;
    // }

    @Value("${spring.application.name}")
    private String center;

    @Value("${zookeeper.addr}")
    private String zookeeper;

    @Bean(initMethod = "init", destroyMethod = "destroy")
    public TaskLeader leaders() {
        TaskLeader taskLeader = new TaskLeader();
        taskLeader.setCenter(center);
        taskLeader.setZookeeper(zookeeper);
        return taskLeader;
    }
}
